# coding: utf-8
# python实现接口类(子类必须重写父类的方法才可以调用)

# 01
class Payment(object):

	def pay(self):
		raise NotImplementedError


class ApplePay(Payment):

	def zhifu(self, money):
		print(f'ApplePay zhifu {money}')



app = ApplePay()
app.zhifu(200)
# app.pay()		# 不重写就抛出异常


# 02
# 利用 abstractmethod
# 带有 abstractmethod 方法的类不能被实例化？

from abc import ABCMeta, abstractmethod


class Payment(metaclass=ABCMeta):

	@abstractmethod
	def pay(self, money): pass


class AppPay(Payment):

	def pay(self, money):
		print(f'AppPay pay {money}')

	def get(self, money):
		print(f'AppPay get {money}')
	pass


app = AppPay()
app.pay(100)
app.get(100)

# Pay = Payment()	# 实例化报错
